mean

 

Mean reports the mean, or average, of the numeric values in a given list. (The mean is calculated by summing all the values, then dividing by the total number of values.) For example,

ask turtles with [ size >= mean [ size ] of turtles ] [ 
    set color red ]

would turn all the turtles who are larger than average red.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the mean primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the mean primitive:
 
 
Similar primitives:
count

Count the number of agents in an agentset.

Read more
max

Report the highest value in a list.

Read more
round

reports the integer to the nearest whole number.

Read more
ceiling

Round a number up to the nearest integer.

Read more
 
Learn another primitive